package edu.xpu.compute.recommend.config;

import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.zaxxer.hikari.HikariDataSource;

/**
 * Mahout数据源配置（使用mysql）
 * @author liukang
 * @date 2019年10月30日
 */
@Configuration
public class MahoutConfig {
	@Autowired
	private HikariDataSource dataSource;

	@Bean(autowire=Autowire.BY_NAME, value="mySqlDataModel")
	public DataModel getMySQLJDBCDataModel(){
		DataModel dataModel=new MySQLJDBCDataModel(dataSource,"SYS_USER_BOOK_RATING","USER_GUID",
				"BOOK_GUID","RATING", "RATING_TIMESTRAP");
		return dataModel;
	}
}
